package com.gitee.empty_null.constants;

import com.gitee.empty_null.exception.domain.*;

/**
 * @author xuhainan
 * @date 2024/1/15 16:01
 * @region hefei
 */
public interface ErrorCodes {

    /**
     * 200
     */
    Ok OK = new Ok("success");

    NoContent NO_CONTENT = new NoContent("无内容");

    // 401
    Unauthorized UNAUTHORIZED = new Unauthorized("未授权");
    Unauthorized ACCESS_DENIED = new Unauthorized("您没有权限，拒绝访问");
    Unauthorized ACCOUNT_DISABLED = new Unauthorized("该账户已经被禁用");
    Unauthorized ACCOUNT_ENDPOINT_LIMITED = new Unauthorized("您已经使用其它终端登录,请先退出其它终端");
    Unauthorized ACCOUNT_EXPIRED = new Unauthorized("该账户已经过期");
    Unauthorized ACCOUNT_LOCKED = new Unauthorized("该账户已经被锁定");
    Unauthorized BAD_CREDENTIALS = new Unauthorized("用户名或密码错误");
    Unauthorized CREDENTIALS_EXPIRED = new Unauthorized("该账户密码凭证已过期");
    Unauthorized INVALID_CLIENT = new Unauthorized("客户端身份验证失败或数据库未初始化");
    Unauthorized INVALID_TOKEN = new Unauthorized("提供的访问令牌已过期、吊销、格式错误或无效");
    Unauthorized INVALID_GRANT = new Unauthorized("提供的授权授予或刷新令牌无效、已过期或已撤销");
    Unauthorized UNAUTHORIZED_CLIENT = new Unauthorized("客户端无权使用此方法请求授权码或访问令牌");
    Unauthorized USERNAME_NOT_FOUND = new Unauthorized("用户名或密码错误");
    Unauthorized SESSION_EXPIRED = new Unauthorized("Session 已过期，请刷新页面后再使用");


    /**
     * 403.** 禁止的请求，与403对应
     */
    Forbidden FORBIDDEN = new Forbidden("禁止的请求");
    Forbidden INSUFFICIENT_SCOPE = new Forbidden("TOKEN权限不足，您需要更高级别的权限");
    Forbidden SQL_INJECTION_REQUEST = new Forbidden("疑似SQL注入请求");


    /**
     * 405.** 方法不允许 与405对应
     */
    MethodNotAllowed METHOD_NOT_ALLOWED = new MethodNotAllowed("方法不允许");
    MethodNotAllowed HTTP_REQUEST_METHOD_NOT_SUPPORTED = new MethodNotAllowed("请求使用的方法类型不支持");


    /**
     * 406.** 不接受的请求，与406对应
     */
    NotAcceptable NOT_ACCEPTABLE = new NotAcceptable("不接受的请求");
    NotAcceptable UNSUPPORTED_GRANT_TYPE = new NotAcceptable("授权服务器不支持授权授予类型");
    NotAcceptable UNSUPPORTED_RESPONSE_TYPE = new NotAcceptable("授权服务器不支持使用此方法获取授权代码或访问令牌");
    NotAcceptable UNSUPPORTED_TOKEN_TYPE = new NotAcceptable("授权服务器不支持撤销提供的令牌类型");

    /**
     * 412.* 未经授权 Precondition Failed 客户端请求信息的先决条件错误
     */
    PreconditionFailed PRECONDITION_FAILED = new PreconditionFailed("户端请求信息的先决条件错误");
    PreconditionFailed INVALID_REDIRECT_URI = new PreconditionFailed("OAuth2 URI 重定向的值无效");
    PreconditionFailed INVALID_REQUEST = new PreconditionFailed("无效的请求，参数使用错误或无效.");
    PreconditionFailed INVALID_SCOPE = new PreconditionFailed("授权范围错误");
    PreconditionFailed METHOD_ARGUMENT_NOT_VALID = new PreconditionFailed("接口参数校验失败，参数使用错误或者未接收到参数");

    /**
     * 415.* Unsupported Media Type	服务器无法处理请求附带的媒体格式
     */
    UnsupportedMediaType UNSUPPORTED_MEDIA_TYPE = new UnsupportedMediaType("服务器无法处理请求附带的媒体格式");
    UnsupportedMediaType HTTP_MEDIA_TYPE_NOT_ACCEPTABLE = new UnsupportedMediaType("不支持的 Media Type");


    /**
     * 500.* Internal Server Error	服务器内部错误，无法完成请求
     */
    InternalServerError INTERNAL_SERVER_ERROR = new InternalServerError("服务器内部错误，无法完成请求");
    InternalServerError SERVER_ERROR = new InternalServerError("授权服务器遇到意外情况，无法满足请求");
    InternalServerError HTTP_MESSAGE_NOT_READABLE_EXCEPTION = new InternalServerError("JSON字符串反序列化为实体出错！");
    InternalServerError ILLEGAL_ARGUMENT_EXCEPTION = new InternalServerError("参数不合法错误，请仔细确认参数使用是否正确。");
    InternalServerError IO_EXCEPTION = new InternalServerError("IO异常");
    InternalServerError MISSING_SERVLET_REQUEST_PARAMETER_EXCEPTION = new InternalServerError("接口参数使用错误或必要参数缺失，请查阅接口文档！");
    InternalServerError NULL_POINTER_EXCEPTION = new InternalServerError("后台代码执行过程中出现了空值");
    InternalServerError TYPE_MISMATCH_EXCEPTION = new InternalServerError("类型不匹配");
    InternalServerError BORROW_OBJECT_FROM_POOL_ERROR_EXCEPTION = new InternalServerError("从对象池中获取对象错误");


    /**
     * 503.* Service Unavailable	由于超载或系统维护，服务器暂时的无法处理客户端的请求。延时的长度可包含在服务器的Retry-After头信息中
     */
    ServiceUnavailable SERVICE_UNAVAILABLE = new ServiceUnavailable("服务不可用");
    ServiceUnavailable COOKIE_THEFT = new ServiceUnavailable("Cookie 信息不安全");
    ServiceUnavailable INVALID_COOKIE = new ServiceUnavailable("不可用的 Cookie 信息");
    ServiceUnavailable PROVIDER_NOT_FOUND = new ServiceUnavailable("授权服务器代码逻辑配置错误");
    ServiceUnavailable TEMPORARILY_UNAVAILABLE = new ServiceUnavailable("由于服务器临时超载或维护，授权服务器当前无法处理该请求");
    ServiceUnavailable SEARCH_IP_LOCATION = new ServiceUnavailable("搜索 IP 定位出现读取错误，服务器当前无法处理该请求");
    ServiceUnavailable OPEN_API_REQUEST_FAILURE = new ServiceUnavailable("基础设施 Open Api 调用请求失败");

}
